---
# title: "Ring Opacity"
title: "轮廓环不透明度"
# description: "Utilities for setting the opacity of outline rings."
description: "用于设置轮廓环的不透明度的功能类。"
---

import plugin from 'tailwindcss/lib/plugins/ringOpacity'
import { Variants } from '@/components/Variants'
import { Disabling } from '@/components/Disabling'

export const classes = {
  plugin,
  transformProperties: ({ selector, properties }) => {
    return properties
  }
}


<!-- ## Usage -->
## 使用

<!-- Use the `ring-opacity-{amount}` utilities to set the opacity of an [outline ring](/docs/ring-width). -->
使用 `ring-opacity-{amount}` 功能来设置[轮廓环](/docs/ring-width)的不透明度。

```html rose
<template preview class="flex justify-center p-8">
  <button tabindex="-1" class="focus:outline-none w-32 py-2 rounded-md font-semibold text-white bg-red-500 ring-4 ring-red-500 ring-opacity-50">
    Button
  </button>
</template>

<button class="... ring-4 **ring-red-500** **ring-opacity-50**">
  Button
</button>
```

---

<!-- ## Responsive

To control the ring opacity at a specific breakpoint, add a `{screen}:` prefix to any existing ring opacity utility. For example, use `md:ring-opacity-50` to apply the `ring-opacity-50` utility at only medium screen sizes and above. -->
## 响应式

要控制特定断点的环形不透明度，请在任何现有的环形不透明度功能类中添加 `{screen}:` 前缀。例如，使用 `md:ring-opacity-50` 来应用 `ring-opacity-50` 功能，只适用于中等尺寸以上的屏幕。

```html
<button class="ring-2 ring-blue-500 ring-opacity-75 **md:ring-opacity-50**">
  <!-- ... -->
</button>
```

<!-- For more information about Tailwind's responsive design features, check out the [Responsive Design](/docs/responsive-design) documentation. -->
关于 Tailwind 的响应式设计功能的更多信息，请查看[响应式设计](/docs/responsive-design)文档。

---

<!-- ## Customizing

You can customize which ring opacity utilities are generated by customizing your global opacity scale under the `opacity` key in the `theme` section of your `tailwind.config.js` file: -->
## 自定义

您可以通过在您的 `tailwind.config.js` 文件的 `theme` 部分的 `opacity` 键下自定义全局不透明度规模来生成哪些环形不透明度功能。

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        opacity: {
+         '15': '0.15',
+         '35': '0.35',
+         '65': '0.65',
        }
      }
    }
  }
```

<!-- If you'd like to customize only the ring opacity utilities without affecting your global opacity scale, use the `ringOpacity` key instead: -->
如果您只想定制环形不透明度功能而不影响全局的不透明度配置，请使用 `ringOpacity` 键。

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        ringOpacity: {
+         '15': '0.15',
+         '35': '0.35',
+         '65': '0.65',
        }
      }
    }
  }
```

<!-- Learn more about customizing the default theme in the [theme customization documentation](/docs/theme#customizing-the-default-theme). -->
在[主题定制文档](/docs/theme#-5)中了解更多关于定制默认主题的信息。

<!-- ### Variants -->
### 变体
<Variants plugin="ringOpacity" />

<!-- ### Disabling -->
### 禁用
<Disabling plugin="ringOpacity" />
